//
//  BN_UserHelperTest.m
//  BabyNow
//
//  Created by iMobile on 14-4-3.
//  Copyright (c) 2014年 iMobile. All rights reserved.
//

#import <XCTest/XCTest.h>

#import "BN_UserHelper.h"
#import "BN_UserInfo.h"

#import "XCTestAsync.h"

@interface BN_UserHelperTest : XCTestCase
{
    BN_UserHelper *userHelper_;
}

@end

@implementation BN_UserHelperTest

- (void)setUp
{
    [super setUp];
    // Put setup code here. This method is called before the invocation of each test method in the class.
    userHelper_ = [[BN_UserHelper alloc]init];
}

- (void)tearDown
{
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    [super tearDown];
    userHelper_ = nil;
}


- (void)testLoginAsync
{
    // 测试老师登录
    [userHelper_ loginWithAccount:kTeacherTestAccount password:kTeacherTestPassword completeHandler:^(id result, NSString *errMsg) {
    
    // 测试家长登录
    //[userHelper_ loginWithAccount:kTestAccount password:kTestPassword completeHandler:^(id result, NSString *errMsg) {
        if (errMsg) {
            XCTAssertNil(errMsg);
        }else{
            NSLog(@"%@",result);            
            BN_UserInfo *userInfo = [BN_UserHelper unArchiverAccountInfo];
            NSLog(@"account:%@",userInfo.account);
            XCAsyncSuccess();
        }
    }];
}

- (void)testQueryNewNotificationsAsync{
    [userHelper_ queryNewNotificationsWithCompleteHandler:^(id result, NSString *errMsg) {
        if (errMsg) {
            XCTAssertNil(errMsg);
        }else{
            NSLog(@"%@",result);
            XCAsyncSuccess();
        }
    }];
}

@end
